package com.itheima.d5_recursion;

import com.itheima.d3_stream.Student;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * 目标：掌握递归的应用，执行流程和算法思想。
 */
public class RecursionTest2 {
    public static void main(String[] args) {
        System.out.println(jc(10));
        System.out.println(sum(5));
        ArrayList<Student> list = new ArrayList<>();
        long i = 0L;
        while(true){
            list.add(new Student());
            System.out.println(list.size());
        }
    }

    public static Long jc(int num){
        if(num == 1){
            return 1L;
        }
        return num * jc(num-1);
    }

    public static Long sum(int num){
        if(num == 1){
            return 1L;
        }
        return num + sum(num-1);
    }




}
